import promise from 'es6-promise';
promise.polyfill();
import axios from 'axios'

axios.defaults.timeout = 20000;
axios.defaults.withCredentials = true;
export default function axiosData(url, method, data, config) {
    var json = (method == 'get') ? { params: data } : data;
    return new Promise((resolve, reject) => {
        axios[method](url, json, config)
            .then(res => {
                console.log(res.data)
                resolve(res.data);

            }).catch(res => {
                reject(res)
            })
    })
}